#!/bin/bash
#功能函数
funcs=./functions.sh
if test ! -f $funcs; then
    funcs=`which functions.sh`
    if [ "$funcs" = "" ]; then
        echo "functions.sh not exist!!"
        return
    else
        echo "funcs=$funcs"
	. $funcs
    fi
else
    echo "funcs=$funcs"
    . $funcs  
fi

#脚步入口：解析参数
while test $# != 0
do
    case $1 in
	-r)
	    shift
	    version=$1
	    ;;
	-m)
	    shift
	    mode=$1
	    ;;
        *)
	    mode=$1
	    ;;
       esac
       shift
done

if [ "$mode" == "auto" ]; then
    echo "auto"
    setup-ethx.sh   -m ${mode}
    setup-telnet.sh -m ${mode}
    setup-nfs.sh    -m ${mode}
    setup-samba.sh  -m ${mode}
    setup-apach2.sh -m ${mode}
    setup-ssh.sh    -m ${mode}
    setup-tftpd.sh  -m ${mode}
    setup-http.sh   -m ${mode}
    setup-ftp.sh    -m ${mode}
else
    menu_list="
setup-ethx.sh
setup-nfs.sh
setup-samba.sh
setup-apach2.sh
setup-ssh.sh
setup-tftpd.sh
setup-http.sh
setup-ftp.sh"
    echoTextBlue "Please select"
    result=`sh_menu_select "$menu_list"`
    echo "${result}"
    ${result}
fi
